
#include "cmsis_os.h" // CMSIS RTOS header file
#include "user_data.h"
/*----------------------------------------------------------------------------
 *      Timer: Sample timer functions
 *---------------------------------------------------------------------------*/
_TKS_FLAGA_type TKS_FLAGA;
/*----- One-Shoot Timer Example -----*/
static void timerCall(void const *arg); // prototype for timer callback function
static osTimerId timer63Ms_handle;      //timer id
static osTimerId timer250Ms_handle;     //timer id
static osTimerId timer500Ms_handle;     //timer id

static osTimerDef(timer63Ms, timerCall);
static osTimerDef(timer250Ms, timerCall);
static osTimerDef(timer500Ms, timerCall);
// Example: Create and Start timers
void Init_Timers(void)
{
    osStatus status; // function return status

    timer63Ms_handle = osTimerCreate(osTimer(timer63Ms), osTimerPeriodic, (void *)63);
    if (timer63Ms_handle != NULL)
    { // One-shot timer created
        // start timer with delay 100ms
        status = osTimerStart(timer63Ms_handle, 63);
        if (status != osOK)
        {
            // Timer could not be started
        }
    }
    timer250Ms_handle = osTimerCreate(osTimer(timer250Ms), osTimerPeriodic, (void *)250);
    if (timer250Ms_handle != NULL)
    { // One-shot timer created
        // start timer with delay 100ms
        status = osTimerStart(timer250Ms_handle, 250);
        if (status != osOK)
        {
            // Timer could not be started
        }
    }
    timer500Ms_handle = osTimerCreate(osTimer(timer500Ms), osTimerPeriodic, (void *)500);
    if (timer500Ms_handle != NULL)
    { // One-shot timer created
        // start timer with delay 100ms
        status = osTimerStart(timer500Ms_handle, 500);
        if (status != osOK)
        {
            // Timer could not be started
        }
    }
}

void timerCall(void const *arg)
{
    switch ((uint32_t)arg)
    {
    case 63:
        TKS_63MSF = 1;

        break;
    case 250:
        TKS_250MSF = 1;
        break;
    case 500:
        TKS_500MSF = 1;
        break;
    default:
        break;
    }
}
